package com.fl.proyect_softmedic;

import com.example.proyect_softmedic.R;
import com.example.proyect_softmedic.R.layout;
import com.example.proyect_softmedic.R.menu;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Resources;
import android.view.Gravity;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;

public class Viewdetails_schedulle_name_patient extends Activity {
	
	//variables para el listado de agendas
    private TableLayout tabla5;
    private TableLayout cabecera5;
    private TableRow.LayoutParams layoutFila5;
    private TableRow.LayoutParams layoutLong5;
    private TableRow.LayoutParams layoutDefault5;
    private Resources rs5;
    private EditText getidschedulle5;
    private TableRow fila5;
    private int role = 1;

    //boton para regresar al menu de inicio
    private Button btnstart;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_viewdetails_schedulle_name_patient);
		
		btnstart = (Button)findViewById(R.id.btnGoStart5);
		btnstart.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub	
				
				if(role==1){
					
				}else{
					//debe ir al menu de recepcionitas
				}
					
			}
		});
		
		//asignacion variables lista de agendas
        rs5 = this.getResources();
        tabla5 = (TableLayout)findViewById(R.id.cabecera5);
        cabecera5 = (TableLayout)findViewById(R.id.cabecera5);
        //layoutFila5 = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,TableRow.LayoutParams.WRAP_CONTENT);
        //layoutLong5 = new TableRow.LayoutParams(200,TableRow.LayoutParams.WRAP_CONTENT);
        //layoutDefault5 = new TableRow.LayoutParams(160,TableRow.LayoutParams.WRAP_CONTENT);
  
        //caja de texto para almacenar el id de la cita seleccionada por el usuario
        getidschedulle5 = (EditText)findViewById(R.id.editNum5);
        getidschedulle5.setFocusable(false);
        getidschedulle5.setVisibility(View.INVISIBLE);
        getidschedulle5.setKeyListener(null);
        
        addheader();
	}
	
	
	//muestra la cabecera de la tabla
		public void addheader(){
		//se definen los objetos a utilizar	
		TableRow fila;		
		TextView txt_date;
		TextView txt_hour;
		TextView txt_name;
		TextView txttype_quote;
		TextView txt_eps;
		TextView txt_particular;
		TextView txt_number_identi;
		TextView txt_history_clinic;
		
		//se asigna el valor del objeto fila y se le asigna el layout fila
		 fila = new TableRow(this);
		// fila.setLayoutParams(layoutFila5);
		 
		 //se asignan valores a los objetos creados previamente

		 txt_date = new TextView(this);
		 txt_hour = new TextView(this);
		 txt_name = new TextView(this);
		 txttype_quote = new TextView(this);
		 txt_eps = new TextView(this);
		 txt_particular = new TextView(this);
		 txt_number_identi = new TextView(this);
		 txt_history_clinic = new TextView(this);

		//se asigna propiedades a el objeto fecha
		 txt_date.setText(rs5.getString(R.string.txtvdate_quote));
		 txt_date.setGravity(Gravity.CENTER_HORIZONTAL);
		 txt_date.setTextAppearance(this,R.style.etiqueta);
		 txt_date.setBackgroundResource(R.drawable.styles_edittext);
		 //txt_date.setLayoutParams(layoutLong5);
		 
		//se asigna propiedades a el objeto hora
		 txt_hour.setText(rs5.getString(R.string.txtv_hour));
		 txt_hour.setGravity(Gravity.CENTER_HORIZONTAL);
		 txt_hour.setTextAppearance(this,R.style.etiqueta);
		 txt_hour.setBackgroundResource(R.drawable.styles_edittext);
		 //txt_hour.setLayoutParams(layoutLong5);
		 
		 //se asigna propiedades a el objeto nombre del paciente
		 txt_name.setText(rs5.getString(R.string.txtv_name_patient));
		 txt_name.setGravity(Gravity.CENTER_HORIZONTAL);
		 txt_name.setTextAppearance(this,R.style.etiqueta);
		 txt_name.setBackgroundResource(R.drawable.styles_edittext);
		 //txt_name.setLayoutParams(layoutLong5);
		 
		 
		 //se asigna propiedades a el objeto tipo de cita
		 txttype_quote.setText(rs5.getString(R.string.txtv_type_quote));
		 txttype_quote.setGravity(Gravity.CENTER_HORIZONTAL);
		 txttype_quote.setTextAppearance(this,R.style.etiqueta);
		 txttype_quote.setBackgroundResource(R.drawable.styles_edittext);
		// txttype_quote.setLayoutParams(layoutLong5);
		 
		//se asigna propiedades a el objeto eps
		 txt_eps.setText(rs5.getString(R.string.txtv_eps));
		 txt_eps.setGravity(Gravity.CENTER_HORIZONTAL);
		 txt_eps.setTextAppearance(this,R.style.etiqueta);
		 txt_eps.setBackgroundResource(R.drawable.styles_edittext);
		 //txt_eps.setLayoutParams(layoutLong5);
		 
		//se asigna propiedades a el objeto particular
		 txt_particular.setText(rs5.getString(R.string.txtv_particular));
		 txt_particular.setGravity(Gravity.CENTER_HORIZONTAL);
		 txt_particular.setTextAppearance(this,R.style.etiqueta);
		 txt_particular.setBackgroundResource(R.drawable.styles_edittext);
		 //txt_particular.setLayoutParams(layoutLong5);
		 
		 //se asigna propiedades a el objeto numero de identificacion
		 txt_number_identi.setText(rs5.getString(R.string.txtv_number_identification));
		 txt_number_identi.setGravity(Gravity.CENTER_HORIZONTAL);
		 txt_number_identi.setTextAppearance(this,R.style.etiqueta);
		 txt_number_identi.setBackgroundResource(R.drawable.styles_edittext);
		 //txt_number_identi.setLayoutParams(layoutLong5);
		 
		 //se asigna propiedades a el objeto historia clinica
		 txt_history_clinic.setText(rs5.getString(R.string.txtv_history_clinic));
		 txt_history_clinic.setGravity(Gravity.CENTER_HORIZONTAL);
		 txt_history_clinic.setTextAppearance(this,R.style.etiqueta);
		 txt_history_clinic.setBackgroundResource(R.drawable.styles_edittext);
		 //txt_history_clinic.setLayoutParams(layoutLong5);
		 
		 // se asignan cada uno de los objetos a la fila
		 fila.addView(txt_date);
		 fila.addView(txt_hour);
		 fila.addView(txt_name);
		 fila.addView(txttype_quote);
		 fila.addView(txt_eps);
		 fila.addView(txt_particular);
		 fila.addView(txt_number_identi);
		 fila.addView(txt_history_clinic);
		 cabecera5.addView(fila);
		 }

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.viewdetails_schedulle_name_patient,
				menu);
		return true;
	}

}
